package com.zhiliao.mybatis.mapper;

import com.zhiliao.mybatis.model.TSysUserRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Description:
 *
 * @author qirong
 * @date 2018-10-26
 */
public interface TSysUserRoleMapper {

    /**
     * deleteByPrimaryKey
     * @param id
     * @return
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * insert
     * @param record
     * @return
     */
    int insert(TSysUserRole record);

    /**
     * selectByPrimaryKey
     * @param id
     * @return
     */
    TSysUserRole selectByPrimaryKey(Integer id);

    /**
     * selectAll
     * @return
     */
    List<TSysUserRole> selectAll();

    /**
     * updateByPrimaryKey
     * @param record
     * @return
     */
    int updateByPrimaryKey(TSysUserRole record);

    /**
     * deleteByUserIdAndRoleId
     * @param userId
     * @param roleId
     * @return
     */
    @Delete("DELETE FROM t_sys_user_role where user_id = #{userId} and role_id=#{roleId}")
    int deleteByUserIdAndRoleId(@Param("userId")Integer userId,@Param("roleId")Integer roleId);

    /**
     * deleteByUserId
     * @param userId
     * @return
     */
    int deleteByUserId(@Param("userId")Integer userId);
}